package com.fzy.designpattern.prototype;

import java.io.Serializable;

/**
 * Cloneable，clone浅复制需要用
 * Serializable序列话和反序列化需要用
 */
@SuppressWarnings("serial")
public class User implements Cloneable, Serializable {

    private String name;
    private int age;

    @Override
    protected Object clone() {
        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
            return null;
        }
    }

    public User(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

}
